<?php
/* @var $this PanelController */
/* @var $model Panel */
/* @var $form CActiveForm */
?>

<div class="form">

    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'panel-_panel-form',
        // Please note: When you enable ajax validation, make sure the corresponding
        // controller action is handling ajax validation correctly.
        // See class documentation of CActiveForm for details on this,
        // you need to use the performAjaxValidation()-method described there.
        'enableAjaxValidation' => false,
        'htmlOptions' => array('enctype' => 'multipart/form-data'),
    ));
    ?>



    <?php echo $form->errorSummary($model); ?>



    <div class="form_left">
        <?php echo $form->labelEx($model, 'name'); ?>
    </div>
    <div class="form_right">
        <?php echo $form->textField($model, 'name', array('size' => 50, 'maxlength' => 200, 'required' => 'required')); ?>
        <?php echo $form->error($model, 'name'); ?>
    </div>
    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'photo'); ?>
    </div>
    <div class="form_right">
        <?php echo $form->fileField($model, 'photo', array('size' => 40, 'maxlength' => 50)); ?>
        <?php echo $form->error($model, 'photo'); ?>
    </div>
    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'url'); ?>
    </div>
    <div class="form_right">
        <?php echo $form->textField($model, 'url', array('size' => 60, 'maxlength' => 200, 'required' => 'required')); ?>
        <?php echo $form->error($model, 'url'); ?>
    </div>
    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'dateCreate'); ?>
    </div>
    <div class="form_right">
        <?php echo $form->textField($model, 'dateCreate', array('class' => 'easyui-datebox', 'data-options' => 'formatter:myformatter,parser:myparser')); ?>
        <?php echo $form->error($model, 'dateCreate'); ?>
    </div>
    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'dateEpend'); ?>
    </div>
    <div class="form_right">
        <?php echo $form->textField($model, 'dateEpend', array('class' => 'easyui-datebox', 'data-options' => 'formatter:myformatter,parser:myparser')); ?>
        <?php echo $form->error($model, 'dateEpend'); ?>
    </div>
    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'type'); ?>
    </div>
    <div class="form_right">
        <?php echo $form->dropDownList($model, 'type', array('5' => 'Banner trang chủ trái', '4' => 'Banner trang chủ phải','3'=>'Banner trang kết quả')); ?>
        <?php echo $form->error($model, 'type'); ?>
    </div>
    <div class="clear"></div>
    <?php
    $session = new CHttpSession;
    $session->open();
    if ($session['user_salesmart'][1] > 98) {
        ?>
        <div class="form_left">
            <?php echo $form->labelEx($model, 'kieu'); ?>
        </div>
        <div class="form_right">
            <?php echo $form->dropDownList($model, 'kieu', array('0' => 'Bình thường', '1' => 'Baner trái gộp 2 ','2' => 'Baner phải gộp 2','3' => 'Baner phải gộp 3')); ?>
            <?php echo $form->error($model, 'kieu'); ?>
        </div>
        <div class="clear"></div>
        <div class="form_left">
            <?php echo $form->labelEx($model, 'vitri'); ?>
        </div>
        <div class="form_right">
            <?php echo $form->textField($model, 'vitri', array('class' => 'easyui-numberspinner', 'style' => 'width:80px;')); ?>
            <?php echo $form->error($model, 'vitri'); ?>
        </div>
        <div class="clear"></div>
    <?php } ?>

    <div class="form_left">.
    </div>
    <div class="form_right">
        <?php echo CHtml::submitButton('Cập nhật'); ?>
    </div>
    <div class="clear"></div>
    <?php $this->endWidget(); ?>
    <script type="text/javascript">
        function myformatter(date) {
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            var d = date.getDate();
            return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
        }
        function myparser(s) {
            if (!s)
                return new Date();
            var ss = (s.split('-'));
            var y = parseInt(ss[0], 10);
            var m = parseInt(ss[1], 10);
            var d = parseInt(ss[2], 10);
            if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
                return new Date(y, m - 1, d);
            } else {
                return new Date();
            }
        }
    </script>
</div><!-- form -->